package org.dong.samples.model;

import java.io.Serializable;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.NotEmpty;
@Entity
@Table(name = "exam_subject")
public class Subject implements Serializable {

	private static final long serialVersionUID = -8761657975555225511L;
	
	@Id
	@GeneratedValue
	@Column(name = "sub_id", nullable = false)
	private Integer subId;
	
	@NotEmpty(message = "姓名不能为空！")
	@Column(name = "name", length = 45, nullable = false)
	private String subName;
	
	@NotEmpty(message = "描述不能为空！")
	@Column(name = "description", length = 255, nullable = false)
	private String description;
	
	@NotNull(message = "人数不能为空！")
	@Column(name = "test_count", nullable = false)
	private Integer testCount;
	
	@NotNull(message = "考试时间不能为空！")
	@Column(name = "total_time", nullable = false)
	private Integer totalTime;
	
	@Column(name = "total_score", nullable = false)
	private double totalScore;
	
	@Column(name = "status", nullable = false)
	private Integer status;
	
	@OneToMany(mappedBy = "subject")
	private Set<UserSubject> userSubject;
	
	@OneToMany(mappedBy = "subject")
	private Set<ExamTest> examTest;
	
	public Subject() {
		super();
	}

	public Subject(Integer subId, String subName, String description, Integer testCount, Integer totalTime,
			double totalScore, Integer status, Set<UserSubject> userSubject, Set<ExamTest> examTest) {
		super();
		this.subId = subId;
		this.subName = subName;
		this.description = description;
		this.testCount = testCount;
		this.totalTime = totalTime;
		this.totalScore = totalScore;
		this.status = status;
		this.userSubject = userSubject;
		this.examTest = examTest;
	}

	public Integer getSubId() {
		return subId;
	}

	public void setSubId(Integer subId) {
		this.subId = subId;
	}

	public String getSubName() {
		return subName;
	}

	public void setSubName(String subName) {
		this.subName = subName;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Integer getTestCount() {
		return testCount;
	}

	public void setTestCount(Integer testCount) {
		this.testCount = testCount;
	}

	public Integer getTotalTime() {
		return totalTime;
	}

	public void setTotalTime(Integer totalTime) {
		this.totalTime = totalTime;
	}

	public double getTotalScore() {
		return totalScore;
	}

	public void setTotalScore(double totalScore) {
		this.totalScore = totalScore;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Set<UserSubject> getUserSubject() {
		return userSubject;
	}

	public void setUserSubject(Set<UserSubject> userSubject) {
		this.userSubject = userSubject;
	}

	public Set<ExamTest> getExamTest() {
		return examTest;
	}

	public void setExamTest(Set<ExamTest> examTest) {
		this.examTest = examTest;
	}

	
}
